package com.dz.lm.service.userorder;

import com.dz.lm.common.dto.PageDto;
import com.dz.lm.common.dto.UserOrderDTO;
import com.dz.lm.common.exception.ServiceException;
import com.dz.lm.domain.userorder.UserOrder;
import com.github.pagehelper.Page;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.Map;
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
public interface UserOrderService {
    /**
     * 添加订单
     * @param appyId
     * @param status 0已付款 1代发货 2待确认 3 交易成功4 申请退款 5同意退款6 拒绝退款 -1 未支付
     * @param price 价格
     * @param clientId 客户
     * @param businessId 商家
      * @param remark
     * @return
     */
    String add(int appyId ,int status , double price ,int clientId , int businessId ,String remark)throws ServiceException;

    /**
     *
     * @param orderId
     * @param status 0已付款 1代发货 2待确认 3 交易成功4 申请退款 5同意退款6 拒绝退款  > -1时更新
     * @param loginsticId 物流
     * @param uid 操作人
     * @return
     */
    int update(String orderId , int applyId,int status ,String loginsticId ,String remark , int uid)throws Exception  ;

    /**
     * 申请单获取订单
     * @param applyId
     * @return
     * @throws ServiceException
     */
    UserOrderDTO get(int applyId)throws ServiceException;

    /**
     * 订单列表
     * @param businessId
     * @return
     * @throws ServiceException
     */
    PageDto query(int pageNum , int rows , int businessId) throws ServiceException;

    /**
     * 成交信息
     * @param businessId
     * @return
     * @throws ServiceException
     */
    Map dealInfo( int businessId) throws ServiceException;

    /**
     *
     * @param order
     * @param status 3交易成功 6 取消交易,退款
     * @throws Exception
     */
    void  addPayOrder(UserOrder order , int status ) throws Exception;

}
